<!-- 公司规模 -->
<template>
  <div class="table w1021">
    <div class="tableTh tableTr flex">
      <span class="tableTd w130">排名</span>
      <span class="tableTd w130">公司代码</span>
      <span class="tableTd w130">中文简称</span>
      <span class="tableTd w220 cursor" @click="columnClick(1)">
        总市值（万元）
        <span v-show="column == 1">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(2)">
        流通市值（万元）
        <span v-show="column == 2">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(3)">
        总股本（万股）
        <span v-show="column == 3">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(4)">
        净利润（万元）
        <span v-show="column == 4">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(5)">
        营业收入（万元）
        <span v-show="column == 5">↓</span>
      </span>
    </div>
    <div
      class="tableTr tableBody top flex"
      v-for="(item, index) in data"
      :key="index"
    >
      <span class="orange tableTd w130">{{ item.rank | filterVal }}</span>
      <span class="orange tableTd w130">{{ item.stockCode | filterVal }}</span>
      <span class="orange tableTd w130">{{ item.stockName | filterVal }}</span>
      <span class="orange tableTd w220">{{
        item.totalVal | filterVal("number")
      }}</span>
      <span class="orange tableTd w220">{{
        item.circulationVal | filterVal("number")
      }}</span>
      <span class="orange tableTd w220">{{
        item.totalShare | filterVal("number")
      }}</span>
      <span class="orange tableTd w220">{{
        item.netProfit | filterVal("number")
      }}</span>
      <span class="orange tableTd w220">{{
        item.operatingRevenue | filterVal("number")
      }}</span>
    </div>
    <div class="tableNone orange w1021 top" v-if="data.length == 0">
      暂无数据
    </div>
  </div>
</template>

<script>
import { number } from "../../script/api";
export default {
  data() {
    return { column: 1 };
  },
  props: ["data"],
  filters: {
    filterVal(ops, num) {
      if (num == "number") {
        return number(ops * 100, num, 1000000);
      }
      return ops ? ops : "--";
    },
  },
  components: {},
  computed: {},
  mounted() {},
  methods: {
    columnClick(ops) {
      if (this.column == ops) return;
      this.column = ops;
      this.$emit("update", { column: ops, method: "scale" });
    },
  },
};
</script>
<style lang="scss" scoped></style>
